<!doctype html>
<html class="no-js">
<head>
	<base href="<?php  echo base_url();?>"/>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="description" content="<?php echo $systemdescription;?>">
	<meta name="keywords" content="<?php echo $systemkeywords;?>">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
	<title><?php echo $systemname;?></title>
	<!-- Set render engine for 360 browser -->
	<meta name="renderer" content="webkit">
	<!-- No Baidu Siteapp-->
	<meta http-equiv="Cache-Control" content="no-siteapp"/>
	<link rel="icon" type="image/png" href="assets/i/favicon.png">
	<!-- Add to homescreen for Chrome on Android -->
	<meta name="mobile-web-app-capable" content="yes">
	<link rel="icon" sizes="192x192" href="assets/i/app-icon72x72@2x.png">
	<!-- Add to homescreen for Safari on iOS -->
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-title" content="<?php echo $systemname?>"/>
	<link rel="apple-touch-icon-precomposed" href="assets/i/app-icon72x72@2x.png">
	<!-- Tile icon for Win8 (144x144 + tile color) -->
	<meta name="msapplication-TileImage" content="assets/i/app-icon72x72@2x.png">
	<meta name="msapplication-TileColor" content="#0e90d2">
	<!-- Amaze UI CSS -->
	<link rel="stylesheet" href="assets/css/amazeui.min.css"/>
	<link rel="stylesheet" href="assets/css/admin.css">
	<script charset="utf-8" src="assets/edit/kindeditor.js"></script>
	<link rel="stylesheet" href="assets/edit/themes/default/default.css" />
	<link rel="stylesheet" href="assets/edit/plugins/code/prettify.css" />
<style>
	    .modi_top0{margin-top:0}
</style>
</head>

<body>

<!--[if lte IE 9]>
<p class="browsehappy">你正在使用<strong>过时</strong>的浏览器，Amaze UI 暂不支持。 请 <a href="http://browsehappy.com/" target="_blank">升级浏览器</a>
  以获得更好的体验！</p>
<![endif]-->
<header class="aam-topbar am-topbar-inverse admin-header am-print-hide" id="headdiv" style="color: #A8E2F8;">
    <div class="am-topbar-brand" >
      <img src="http://i4.buimg.com/89527d8f01171c15.png" alt="" style="width:5rem"><strong><?php echo $authorization; ?></strong><small><?php echo $systemname; ?></small>
    </div>
    <div class="am-collapse am-topbar-collapse" >

    </div>
  </header>
  <hr class="modi_top0">
<div class="am-g">
	<div class="am-u-md-5 am-u-md-centered">	
		<div class="am-avg-sm-1 am-avg-md-1 am-margin  am-text-center admin-content-list " id="showrandom">
			<img  src="http://i4.piimg.com/518247/33828ea07b022fae.png" alt="" style="width:90%";>
		</div>
		<div class="am-avg-sm-1 am-avg-md-1 am-margin am-padding am-text-center admin-content-list">
  			<button class="am-btn am-btn-success am-fr" id="reset_random" >重置</button>
  			<button class="am-btn am-btn-success am-fr" id="pause_random" disabled>暂停</button>
  			<button class="am-btn am-btn-success am-fr" id="start_random">开始</button>
		</div>
	</div>	
</div>

<!--[if lt IE 9]>
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="http://cdn.amazeui.org/amazeui/2.6.1/js/amazeui.ie8polyfill.min.js"></script>
<![endif]-->

<!--[if (gte IE 9)|!(IE)]><!-->
<script src="//libs.useso.com/js/jquery/2.1.1/jquery.min.js"></script>
<!--<![endif]-->
<script src="//cdn.amazeui.org/amazeui/2.6.1/js/amazeui.min.js"></script>
<footer class="am-topbar am-topbar-fixed-bottom" style="     min-height: 36px; " id="footdiv">
  <!--版权框-->
    <div class="am-cf">
      <strong class="am-text-center" style="display:block;color:#899b9e;font-size: 1.2rem">系统授权：<?php echo $authorization;?></strong>
      <small class="am-text-center" style="display:block;color:#899b9e;font-size: 1.1rem">CopyRight By <?php echo $webroot.$web_license?> </small>
    </div>
</footer>
<script>
var randomstr;
$(function(){
	$("#start_random").on('click', function() {
		$('#pause_random').attr("disabled",false);
		$(this).attr("disabled",true);
		ajxa_get("<?php echo $authorizationid;?>");
	});
	$("#pause_random").on('click', function() {
		$('#start_random').attr("disabled",false);
		$(this).attr("disabled",true);
		clearInterval(timer);
		ajxa_modi("<?php echo $authorizationid;?>",$("#randomtext").html());
	});
	$("#reset_random").on('click', function() {
		$("#showrandom").html('<img  src="http://i4.piimg.com/518247/33828ea07b022fae.png" alt="" style="width:90%";>');
		ajxa_reset("<?php echo $authorizationid;?>");
	});
	$("#showrandom").on('click',function(){
		if($('#start_random').attr("disabled")){
		//	alert(1);
			$("#pause_random").click();
		}else{
		//	alert(2);
			$("#start_random").click();
		}
	})
});	
</script>
<script>
	function ajxa_get(authorizationid){
    $.ajax({
      url: 'random/random/ajxa_get',
      type: 'post',
      dataType: 'json',
      data: {"id": authorizationid	},
      success: function(data)
      {
      	if(data.length>0) {
      		randomstr = data;
       		timer=window.setInterval('testTime()',20);
      	}else{
      		alert("已结抽完");
      	}
    }
    });
   }
   function ajxa_modi(authorizationid,random){
    $.ajax({
      url: 'random/random/ajxa_modi',
      type: 'post',
      dataType: 'json',
      data: {"id": authorizationid,"random":random	},
      success: function(data)
      {
      	
    }
    });
   }
   function ajxa_reset(authorizationid){
    $.ajax({
      url: 'random/random/ajxa_reset',
      type: 'post',
      dataType: 'json',
      data: {"id": authorizationid} });
   }
</script>
<script type="text/javascript"> 
	function testTime(){
		var index = Math.floor((Math.random()*randomstr.length)); 
		document.getElementById("showrandom").innerHTML="<h2 style='font-size: 16em;color:#0B4969;' id='randomtext'>"+randomstr[index]+"</h2>";
	}
</script>
</body>
</html>